package com.example.demo43.Entity;

import javax.persistence.*;
import java.util.List;

@Entity(name="role")
@Table(name="role")
public class Role {
    @Id
    @Column(name="id")
    private Integer id;
    @Column(name="role")
    private  String role;
    @ManyToMany
    @JoinTable(name = "user_role_relation",joinColumns = {@JoinColumn(name="role_id")},
            inverseJoinColumns = {@JoinColumn(name = "user_id")})
    private List<User> userList;

    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getRole() {
        return this.role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public List<User> getUserList() {
        return this.userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }
    @Override
    public String toString() {
        return "Role{" +
                "id=" + id +
                ", role='" + role + '\'' +
                ", userList=" + userList +
                '}';
    }
}
